//
//  FBCTutorialsLogin.m
//  TutorialsModule
//
//  Created by Luciano Perez Rocha on 12/10/09.
//  Copyright 2009 __MyCompanyName__. All rights reserved.
//

#import "FBCTutorialsLogin.h"


@implementation FBCTutorialsLogin

@synthesize session;

/*
 // The designated initializer.  Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
        // Custom initialization
    }
    return self;
}
*/


// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    [super viewDidLoad];
	
	//inicio la session con los datos de la app	
	session = [FBSession sessionForApplication:@"0fd667daea3c2db4722f9972e2715714" secret:@"ecfa6208959b424fc1bd5b31c39cced5" delegate:self];
	
	// boton para el login.
	FBLoginButton *login = [[[FBLoginButton alloc] init] autorelease];
	[self.view addSubview:login];
	
}

// si se logueo con exito, llama a este metodo.
-(void) session: (FBSession *) session didLogin:(FBUID)uid
{

}

/**
 * Called when a session is about to log out.
 */
- (void)session:(FBSession*)session willLogout:(FBUID)uid{}

/**
 * Called when a session has logged out.
 */
- (void)sessionDidLogout:(FBSession*)session{}



/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/

- (void)didReceiveMemoryWarning {
	// Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
	
	// Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
	// Release any retained subviews of the main view.
	// e.g. self.myOutlet = nil;
}


- (void)dealloc {
    [super dealloc];
	[session logout];
}


@end
